@import url('https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,500,600');
@import url('https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,500,600');
@import './common.scss';

:root,
html[data-theme='light'] {
  --color-background: #{$white};
  --color-text: #{$black};
  --color-text-hsl: 0, 0%, 0%;
  --color-link-decoration: #{$main};
  --color-main: #{$main};
  --color-pre-background: #{$black};
}

html[data-theme='dark'] {
  --color-background: #{$black};
  --color-text: #{$white};
  --color-text-hsl: 0, 100%, 100%;
  --color-link-decoration: #{$gray};
  --color-main: #{$main--dark};
  --color-pre-background: #{$main--dark};
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: $font-body;
  font-weight: $font-weight-regular;
  background-color: var(--color-background);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.555rem;

  @include from($desktop) {
    font-size: 18px;
  }
}

.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

p {
  margin: 0;
  text-align: left;
  line-height: 1.5em;
  color: var(--color-text);
}

a {
  text-decoration: none;
  color: var(--color-text);
}

.link {
  a {
    border-bottom: 2px solid var(--color-link-decoration);

    &:hover {
      background-color: var(--color-main);
    }
  }
}

.container {
  position: relative;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 90%;
  max-width: $large;

  @include to($tablet) {
    padding: 0 20px;
  }
}

.container--right {
  @include from($desktop) {
    margin-right: 5%;
    width: 54%;
    max-width: $large/1.6667;

    @include from($large) {
      margin-right: calc((100% - #{$large}) / 2);
    }
  }
}

.hidden {
  display: none !important;
}

.centered {
  text-align: center;
}

.centered--mobile {
  @include to($tablet) {
    justify-content: center;
    align-content: center;
    align-items: center;
  }
}

.spacing {
  margin-top: $vertical-spacing * 2;

  &--tablet {
    @media (max-width: $desktop) and (min-width: $tablet) {
      margin-top: $vertical-spacing * 5 !important;
    }
  }

  @include from($desktop) {
    margin-top: $vertical-spacing * 5;
  }
}

.spacing--small {
  margin-top: $vertical-spacing;

  @include from($desktop) {
    margin-top: 3.444rem;
  }
}

.spacing--large {
  margin-top: $vertical-spacing * 4;

  @include from($desktop) {
    margin-top: $vertical-spacing * 10;
  }
}

.spacing--extra-large {
  margin-top: $vertical-spacing * 4;

  @include from($desktop) {
    margin-top: $vertical-spacing * 20;
  }
}

.spacing--after {
  margin-bottom: $vertical-spacing * 2;

  @include from($desktop) {
    margin-bottom: $vertical-spacing * 5;
  }

  &--mobile {
    @include to($tablet) {
      margin-bottom: $vertical-spacing * 5;
    }
  }
}

.spacing--after-small {
  @include from($desktop) {
    margin-bottom: $vertical-spacing * 2.5;
  }
}

.spacing--after-large {
  margin-bottom: $vertical-spacing * 4;

  @include from($desktop) {
    margin-bottom: $vertical-spacing * 10;
  }
}

.spacing--mobile {
  @include to($desktop) {
    margin-top: $vertical-spacing * 2;
  }

  &--small {
    @include to($large) {
      margin-top: $vertical-spacing * 1.5;
    }
  }

  &--large {
    @include to($large) {
      margin-top: $vertical-spacing * 3;
    }
  }
}

@for $i from 1 through 10 {
  .col-#{$i} {
    width: 100%;
    @include from($desktop) {
      width: #{$i * 10%};
    }
  }
}

@include from($desktop) {
  @for $i from 1 through 5 {
    .push-right-#{$i} {
      margin-left: $i * 10%;
    }
  }

  @for $i from 1 through 5 {
    .push-left-#{$i} {
      margin-right: $i * 10%;
    }
  }

  .push-left {
    margin-right: auto;
  }

  .push-right {
    margin-left: auto;
  }
}

@include to($tablet) {
  @for $i from 1 through 10 {
    .col-#{$i}--mobile {
      width: #{$i * 10%} !important;
    }

    @for $i from 1 through 5 {
      .push-right-#{$i}--mobile {
        margin-left: $i * 10% !important;
      }
    }

    @for $i from 1 through 5 {
      .push-left-#{$i}--mobile {
        margin-right: $i * 10% !important;
      }
    }
  }

  @for $i from 0 through 5 {
    .order-#{$i}--mobile {
      order: $i;
    }
  }
  .hidden--mobile {
    display: none;
  }
}

@include to($large) {
  @for $i from 1 through 10 {
    .col-#{$i}--tablet {
      width: #{$i * 10%};
    }

    @for $i from 0 through 5 {
      .order-#{$i}--tablet {
        order: $i;
      }
    }
  }

  @for $i from 0 through 5 {
    .order-#{$i}--mobile {
      order: $i;
    }
  }
  .hidden--mobile {
    display: none;
  }
}

.centered-vertically {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nav-item-hover {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  padding: 0.2em;

  @include from($tablet) {
    font-weight: $font-weight-semi-bold;
  }

  &:hover,
  &:active,
  &:focus {
    color: var(--color-background);
    background-color: var(--color-text) !important;
  }

  &:focus,
  &:active {
    outline: 2px solid $blue;
  }
}

.nav-item-active {
  border-bottom: 2px solid var(--color-text);
}

.flex-fix-aligning {
  &::before,
  &::after {
    content: '';
    width: 30%;
    order: 2;
  }
}

.auto-bottom-margin {
  margin-bottom: auto;
}

.frontpage-hero {
  flex-direction: column;
  flex-wrap: nowrap;
}

.frontpage-hero__content {
  @include to($desktop) {
    z-index: 1;
    margin-bottom: 3rem;
  }
}

.frontpage-hero__heading {
  hyphens: auto;
  font-size: 2rem;

  @include from($tablet) {
    font-size: 2.5rem;
  }

  @include from($large) {
    font-size: 3rem;
  }
}

.frontpage-hero__cta {
  display: inline-block;
  margin-bottom: 4rem;
}

.frontpage-hero__description {
  max-width: $tablet-content;
}

.frontpage-hero__image {
  @include to($desktop) {
    position: absolute !important;
    right: -5%;
    top: -40px;
    opacity: 0.1;

    img {
      transform: translateX(33%);
    }
  }

  @include to($tablet) {
    right: -40px;
  }
}

.heading-font {
  font-family: $font-heading;
}

.about__challenge-button {
  box-shadow: -3px 5px var(--color-text);
  padding: 0.6rem 1rem;
  border: 3px solid var(--color-text);
  font-weight: $font-weight-semi-bold;

  &:hover {
    background-color: var(--color-text);
    color: var(--color-background);
    cursor: pointer;
  }

  &--turquoise {
    background-color: $turquoise;
  }

  html[data-theme='dark'] & {
    color: var(--color-text);
    box-shadow: -3px 5px var(--color-text);
    border: 3px solid var(--color-text);

    &:hover {
      background-color: var(--color-text);
      color: var(--color-background);
    }

    &--turquoise {
      color: var(--color-main);
      box-shadow: -3px 5px var(--color-main);
      border: 3px solid var(--color-main);

      &:hover {
        background-color: var(--color-main);
        color: var(--color-text);
      }
    }
  }
}

.space-between--mobile {
  @include to($large) {
    justify-content: space-between;
  }
}

.challenge__banner {
  display: flex;
  justify-content: center;
  margin-bottom: -70px;

  @include from($tablet) {
    transform: translateY(-10px);
  }

  @include from($large) {
    margin-bottom: -370px;
  }

  .image {
    margin: 0;
    width: 70%;
    transform: translateY(-25%);

    @include from($tablet) {
      transform: translateY(-10%);
    }

    @include from($large) {
      transform: translateY(-30%);
    }
  }
}
